package org.ntu.rtsearch.index.model;

import java.util.HashMap;
import java.util.Map;

public class Document {
	
	private static volatile int docCount = 0;
	
	private Map<String, Field> fields = new HashMap<String, Field>();
	
	private long timeStamp;
	
	private int docId;
	
	public Document(long timeStamp) {
		this.docId = docCount++;
		this.timeStamp = timeStamp;
	} 
	
	public static int getDocAmount() {
		return docCount;
	}
	
	public Field getField(String fName) {
		return fields.get(fName);
	}
	
	public void add(Field field) {
		fields.put(field.getName(), field);
	}
	
	public Map<String, Field> getFields() {
		return fields;
	}

	public int getDocId() {
		return docId;
	}

	public void setTimeStamp(long timeStamp) {
		this.timeStamp = timeStamp;
	}

	public long getTimeStamp() {
		return timeStamp;
	}

	
}
